import java.io.Serializable;
import java.util.regex.Pattern;

public class Person implements Serializable
{
	private static final long serialVersionUID = 8057135377033276621L;
	private String name;
	private int totalPapers;
	private int totalCitations;
	
	public Person()
	{}
	
	public Person(String name)
	{
		this.setName(name);
		totalPapers = 0;
		totalCitations = 0;
	}
	
	public String formatName()
	{
		String newName = this.name.toLowerCase();
		newName = Pattern.compile("((mr|ms|miss|mrs|prof(essor)?|dr)(\\.|\\s))|,").matcher(newName).replaceAll("");
		newName = newName.replace(' ', '+');
		
		return newName;
	}
	
	/*
	 *  GETTERS & SETTERS
	 */
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setTotalPapers(int totalPapers) {
		this.totalPapers = totalPapers;
	}
	public int getTotalPapers() {
		return totalPapers;
	}
	public void setTotalCitations(int totalCitations) {
		this.totalCitations = totalCitations;
	}
	public int getTotalCitations() {
		return totalCitations;
	}
	
	
	public static void main(String [] args)
	{
		String before = "simon wielens";
		Person p = new Person(before);
		String after = p.formatName();
		System.out.println("before: " + p.getName());
		System.out.println("after: " + after);
	}
	
}
